package saves.objects;

import game.LScript;
import java.util.ArrayList;
import menu.ItemInterface;
import menu.Menu;
import org.jbox2d.dynamics.World;
import saves.EntidadeNave;
import saves.Inventory;
import saves.Inventory.ItemEx;

/**
 *
 * @author Luan
 */
public class Container extends Corpo {
    private static final long serialVersionUID = 1L;
    
    private int tipo;
    private Inventory inv;
    
    public static final int[] IMAGENS = new int[] { 0, 1, 2 };
    
    protected Container() {}
    
    public Container(float x, float y, int tipo, ArrayList<ItemEx> inventory, double money, World world) {
        this(x, y, tipo, 10, inventory, money, world); //todo change default's!
    }
    
    public Container(float x, float y, int tipo, float volumeLimit, ArrayList<ItemEx> inventory, double money, World world) {
        super(x, y, IMAGENS[tipo], world);
        this.tipo = tipo;
        this.inv = new Inventory(inventory, money, volumeLimit);
    }
    
    public int getTipo() {
        return this.tipo;
    }
    
    public Inventory getInventory() {
        return this.inv;
    }
    
    @Override
    public Menu getInterface(int codigo, EntidadeNave player) {
        //there is only one possible interface:
        return new ItemInterface(player, this);
    }
    
    @Override
    public String[] getInterfaces() {
        return new String[] {"Item Interface"};
    }
    
    @Override
    public String getDescription() {
        return "A simple container for items. It can hold up to " + LScript.format(inv.getVolumeLimit()) + " volume units.";
    }
    
    @Override
    public String toString() {
        return "Item Container";
    }
}
